{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from coclust.io.data_loading import load_doc_term_data\n",
    "from coclust.coclustering import CoclustPLBcem\n",
    "from sklearn.metrics.cluster import normalized_mutual_info_score as nmi\n",
    "\n",
    "# read data\n",
    "path = '../datasets/classic3_coclustFormat.mat'\n",
    "doc_term_data = load_doc_term_data(path)\n",
    "X = doc_term_data['doc_term_matrix']\n",
    "true_doc_labels = doc_term_data['doc_labels']\n",
    "\n",
    "# process\n",
    "model = CoclustPLBcem(n_row_clusters=3, n_col_clusters=3)\n",
    "model.fit(X)\n",
    "\n",
    "# evaluate\n",
    "predicted_doc_labels = model.row_labels_\n",
    "print(nmi(true_doc_labels, predicted_row_labels))\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
